// AboutDlg.cpp : implementation file
//

#include "stdafx.h"
#include "TravianAutoTask.h"
#include "HyperLink.h"
#include "AboutDlg.h"


// CAboutDlg dialog

IMPLEMENT_DYNAMIC(CAboutDlg, CDialog)

CAboutDlg::CAboutDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CAboutDlg::IDD, pParent)
{

}

CAboutDlg::~CAboutDlg()
{
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_MAILTO, m_hyperLink);
}


BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()


// CAboutDlg message handlers

BOOL CAboutDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here

	m_hyperLink.SetURL(_T("mailto:mila@freemail.hu"));

	TCHAR szFileName [MAX_PATH];
	::GetModuleFileName(NULL, szFileName, sizeof(szFileName)/sizeof(TCHAR) );

	TCHAR szVerInfo [2000];

	DWORD dwSize = ::GetFileVersionInfoSize( szFileName, 0);

	::GetFileVersionInfo(
		szFileName,
		0,				// ignored
		dwSize,			// size of buffer
		szVerInfo       // version information buffer
	);

	TCHAR szSubBlock[64];
	wsprintf( szSubBlock, 
			_T("\\StringFileInfo\\000904b0\\FileVersion")
			);

	LPVOID  lpInfo;
	unsigned int nSize;
	// Retrieve file version
	::VerQueryValue(szVerInfo,
				szSubBlock,
				&lpInfo,
				&nSize);

	TCHAR szVersion[MAX_PATH];
	_tcscpy_s(szVersion, sizeof(szVersion), (LPTSTR)lpInfo);

	CString sVersion;
	sVersion.Format(_T("Travian Auto-Task Version %s"), szVersion);
	GetDlgItem(IDC_STATIC_VERSION)->SetWindowText(sVersion);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
